package org.bigjava.novelplatform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.bigjava.novelplatform.common.enums.ActionType;
import org.bigjava.novelplatform.entity.Books;
import org.bigjava.novelplatform.entity.ChapterSays;

import java.util.List;

/**
* @author YKH
* @description 针对表【chapter_says】的数据库操作Mapper
* @createDate 2022-03-20 14:42:21
* @Entity org.bigjava.novelplatform.entity.ChapterSays
*/
public interface ChapterSaysMapper extends BaseMapper<ChapterSays> {

    /**
     * 增加点赞数或点踩数
     * @param id
     * @param type
     */
    void addRecord(@Param("id") Long id, @Param("type") ActionType type);

    /**
     * 减少点赞数或点踩数
     * @param id
     * @param type
     */
    void reduceRecord(@Param("id") Long id, @Param("type") ActionType type);

    List<ChapterSays> selectChapterSays(Long chapterId, Integer paragraphLocation);

    List<ChapterSays> selectChapterSaysZipin(Long chapterId, Integer conversationTargetId);

    /**
     * 按指定的点踩数区间大小获取本章说 列：点踩数处于0-100之间的本章说有n章
     */
    Integer selectChapterSaysPage(@Param("head") Integer head, @Param("tail") Integer tail);

    Integer selectDownholeCountMax();

    /**删除点踩数超过指定阀值的本章说*/
    Integer updateByDownholeCount(@Param("size") Integer size);
}




